﻿using System;
using System.Collections.Generic;
using System.Text;
using ST.Dal;
using ST.Model;

namespace ST.Bll
{
    public class CategoryBLL
    {
        private static readonly CategoryDal dal = new CategoryDal();
        public CategoryBLL() { }
        public void CreateCategory(Category category)
        {
            int CategoryID = dal.CreateCategory(category);
            category.CategoryID = CategoryID;
        }
        public Category GetCategory(int categoryId)
        {
            if (categoryId <= 0)
                return null;
            return dal.GetObject(categoryId);
        }
        public bool UpdateCategory(Category category)
        {
            return dal.UpdateCategory(category);
        }
        public bool DeleteCategory(Category category)
        {
            return dal.DeleteObject(category.CategoryID);
        }
        public List<Category> GetList()
        {
            return dal.GetList(null, 0);
        }
    }
}
